package com.welsmann.app.start.dao.impl;

import java.util.List;

import org.springframework.orm.hibernate3.HibernateTemplate;
import org.springframework.stereotype.Component;

import com.welsmann.app.start.dao.BaseDAO;
import com.welsmann.app.start.dao.ISimpleAirQualityDAO;
import com.welsmann.app.start.entity.SimpleAirQuality;
@SuppressWarnings("unchecked")
@Component("SimpleAirQualityDAO")
public class SimpleAirQualityDAO extends BaseDAO implements
		ISimpleAirQualityDAO {

	private HibernateTemplate _ht = null;
	
	@Override
	public SimpleAirQuality latest() {
		_ht = new HibernateTemplate(super.sessionFactory);
		List<SimpleAirQuality> list = _ht
				.find("from SimpleAirQuality saq order by publish desc limit 1");
		return list != null && !list.isEmpty() ? list.get(0) : null;
	}

}
